package com.yss.exams;

import java.util.LinkedList;
import java.util.List;
import java.util.Optional;

/**
 * 树节点类，不得改修此类。
 */
public final class TreeNode {
  private final String data;
  private final List<TreeNode> children = new LinkedList<>();

  public TreeNode(String data) {
    this.data = data;
  }

  public List<TreeNode> getChildren() {
    return this.children;
  }

  public Optional<String> getData() {
    return (null==this.data) ? Optional.empty() : Optional.of(this.data);
  }
}
